package com.itlong.cloud.POJO.VO.property;

import com.itlong.cloud.enumerate.AppUserProjectStatusEnum;
import com.itlong.cloud.enumerate.AppUserRoomHouserTypeEnum;
import com.itlong.cloud.enumerate.AppUserRoomSourceEnum;
import com.itlong.cloud.enumerate.AppUserRoomStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang.StringUtils;

/**
 * <desc>
 *      用于组装返回给前端时用的物业住户信息返回对象(AppUserInfoGetVO)中的住户房间信息
 * </desc>
 *
 * @createDate 2017-11-15
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AppUserInfoGetRoomVO {
    private String userProjectStatus;      //用户项目状态：0冻结 1启用(AppUserProjectPO)
    private String userProjectStatusName;   //用户项目状态名称
    private String projectName;     //项目名称
    private String projectId;       //项目Id
    private String buildName;       //楼栋名称
    private String buildId;         //楼栋Id
    private String unitName;        //单元名称
    private String unitId;          //单元Id
    private String roomId;          //房间Id
    private String roomNum;         //房间号
    private String roomName;        //房间名称
    private String houserType;      //住户身份：自定义
    private String houserTypeName;  //住户身份名称
    private Integer source;     //用户来源:1邀请 2注册 3管理员添加 4一卡通(AppUserRoomPO)
    private String sourceName;  //用户来源名称
    private Integer userRoomStatus;     //用户房间状态：1待审核 2迁入 3迁出 4未通过(AppUserRoomPO)
    private String userRoomStatusName;  //用户房间状态名称
    private String createTime;        //住户房间信息创建时间
    private String updateTime;      //更新时间
    private Integer roomType;   // 房屋类型，1住宅 3办公
    private String roleName;

    public String getUserProjectStatusName() {
        if(StringUtils.isNotBlank(userProjectStatus)) {
            return AppUserProjectStatusEnum.getDescription(Integer.parseInt(userProjectStatus));
        } else {
            return userProjectStatusName;
        }
    }

    public String getSourceName() {
        if(source != null) {
            return AppUserRoomSourceEnum.getDescription(source);
        } else {
            return sourceName;
        }
    }

    public String getUserRoomStatusName() {
        if(userRoomStatus != null) {
            return AppUserRoomStatusEnum.getDescription(userRoomStatus);
        } else {
            return userRoomStatusName;
        }
    }
}
